package com.star.star.Activity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.star.star.R;
import com.zzhoujay.richtext.ImageHolder;
import com.zzhoujay.richtext.RichText;

public class AidDetailsActivity extends AppCompatActivity implements View.OnClickListener {
    private TextView tv_main_title, tv_back,tvModuleContext;
    private static final String TEST_CONTENT = "<div class=\"content\" data-a-686478ee><div data-click=\"{&quot;page&quot;:&quot;news&quot;}\" class=\"wa-news-content-container c-response-content c-response-margin-top20\" data-a-03c92b82 data-a-686478ee><div class=\"wa-news-content-container-text c-line-bottom c-response-content-left\" data-a-03c92b82><div class=\"wa-news-content-title\" data-a-03c92b82>\n" +
            "            临阵换帅对上抠门足协,西班牙与葡萄牙一战,场外因素更吸睛\n" +
            "        </div> <div class=\"wa-news-content-baijiahao\" data-a-03c92b82><div class=\"avatar\" style=\"background:url(https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3152531304,3163889458&fm=26&gp=0.jpg) center / cover no-repeat;border-radius:50%;\" data-a-03c92b82></div> <div class=\"info\" data-a-03c92b82><div class=\"title\" data-a-03c92b82>篮球快报</div> <div class=\"msg\" data-a-03c92b82><span class=\"seperator\" data-a-03c92b82><span data-a-03c92b82>百家号</span></span><span style=\"margin-left:.08rem;\" data-a-03c92b82>06-15 15:01</span></div></div></div> <div class=\"wa-news-content-body\" data-a-03c92b82><div data-a-03c92b82><div class=\"wa-news-content-body-text c-font-big\" data-a-03c92b82>\n" +
            "                    如果问世界杯小组赛期间最劲爆的对决是哪一组？估计十之八九的中立球迷在期待着西班牙与葡萄牙之间的双牙之争。这两支夺冠的热门球队，都是出自伊比利亚半岛，真可谓是同根同源。两支球队也各有特色，西班牙群星云集，而葡萄牙则拥有“绝代双骄”之一的C罗。\n" +
            "                </div></div><div data-a-03c92b82><div class=\"wa-news-content-body-img\" style=\"margin-top:-.08rem;\" data-a-03c92b82><img src=\"https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2236233498,458507645&fm=26&gp=0.jpg\" width=\"100%\" data-a-03c92b82></div></div><div data-a-03c92b82><div class=\"wa-news-content-body-text c-font-big\" data-a-03c92b82>\n" +
            "                    西班牙的阵容堪称豪华：德赫亚一夫当关；卡尔哈尔、阿尔巴双翼齐飞；皮克看穿一切；拉莫斯固若金汤；伊涅斯塔老骥伏枥；布斯克斯左右逢源；大卫席尔瓦人球合一；迭戈科斯塔宛如战兽……还有伊斯科、阿森西奥等年轻俊杰，随时能为球队提供活力。\n" +
            "                </div></div><div data-a-03c92b82><div class=\"wa-news-content-body-text c-font-big\" data-a-03c92b82>\n" +
            "                    而葡萄牙则是C罗一个人的球队。C罗身为当世最好的两位超巨之一，无论何时何地，他都有着摧毁对手防线的魔力。只要给他一点点的机会或者是空隙，他都有办法杀死比赛的悬念。\n" +
            "                </div></div><div data-a-03c92b82><div class=\"wa-news-content-body-img\" style=\"margin-top:-.08rem;\" data-a-03c92b82><img src=\"https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2763005844,2120939408&fm=26&gp=0.jpg\" width=\"100%\" data-a-03c92b82></div></div><div data-a-03c92b82><div class=\"wa-news-content-body-text c-font-big\" data-a-03c92b82>\n" +
            "                    最佳球队对阵最佳球员，这种比赛放在任何时代都是焦点中的焦点。不过，就是这样的一场堪称火星撞地球的较量，却被双方的场外因素给吸了睛。";

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_aid_details);
        tv_back = findViewById(R.id.tv_back);
        tv_main_title = findViewById(R.id.tv_main_title);
        tvModuleContext = findViewById(R.id.tvModuleContext);
        tv_main_title.setText("资讯详情");
        tv_back.setOnClickListener(this);
        RichText.initCacheDir(this);
        init();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_back:
                AidDetailsActivity.this.finish();
                break;
        }
    }

    private void init() {
        RichText.from(TEST_CONTENT).bind(this)
                .showBorder(false)
                .size(ImageHolder.MATCH_PARENT, ImageHolder.WRAP_CONTENT)
                .into(tvModuleContext);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        RichText.clear(this);
    }
}
